package com.itheima.sc.result;

import lombok.Data;

@Data
public  class Result<T> {

    private Integer code;

    private String message; //错误信息

    private T data; //数据

    public static <T> Result<T> success(T object) {
        Result<T> r = new Result<T>();
        r.data = object;
        r.message="操作成功";
        r.code = 200;
        return r;
    }
    public static <T> Result<T> error(String message) {
        Result<T> r = new Result<>();
        r.message = message;
        r.code = 0;
        return r;
    }

}
